Gradient
The gradient of a function has multiple interpretations and uses in mathematics. We will explore the gradient in the context of functions of multiple variables.
Table of Contents
Introduction
As previously stated, there are a few ways to think about the gradient of a function.
Purely computationally, the gradient is essentially a collection of all the partial derivatives of a function.
So for a function
Consider the function
The gradient is often denoted as
Hence, to create a more general definition, we can define the gradient of a function
Notice that the gradient is a vector, and its dimensions match the number of inputs to the function. In terms of basis vectors, the gradient can be written as:
Recall that the partial derivative is an "incomplete" way to measure the rate of change. In this sense, the gradient can be thought of as the "full" derivative of a function of multiple variables.
The Nabla
One convenient way to think about the gradient is to consider the symbol
Then, the gradient of
Gradients in the Context of Graphs
Outside of the computational context, there's a graphical way to think about the gradient.
Consider this simple function
We can plot this as a vector field.
In this graph, the gradient is represented as a vector field, more commonly known as a "gradient field".
One thing to note is that the gradient points in the "direction of the steepest ascent" of the function. So if you were to walk along the surface of the function, you would be walking in the direction where the function increases the fastest. This is not immediately obvious, but will become more apparent in light of directional derivatives.
Gradient in Contour Plots
It's important to understand how the gradient relates to contour plots.
Consider the function
The gradient of
Like before, we can plot this as a gradient field along with the contour plot:
The important thing to notice is that the vector appears to point perpendicular to the contour lines. To see why this is the case, zoom in on 2 contour lines:
Recall that the gradient points in the direction of the steepest ascent.
Instead of thinking of the steepest ascent, consider which direction the function increases from
Summary and Next Steps
In this section, we introduced the concept of the gradient of a function.
Here are the key points to remember:
- The gradient of a function is a vector of partial derivatives.
- The gradient points in the direction of the steepest ascent of the function.
- The gradient is perpendicular to the contour lines of the function.
- The gradient can be thought of as the "full" derivative of a function of multiple variables.
Next, we will explore the directional derivative, which is a generalization of the derivative in a specific direction.